package com.example.netty.protocoltcp;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
                // 数据从客户端出 需要编码 成 byte，出站编码器
        pipeline.addLast(new MyMessageEncoder())
                // 数据进入客户端，需要从byte 解码，入站解码器
                .addLast(new MyMessageDecoder())
                .addLast(new MyClientHandler());
    }
}
